var page = require('./page')
var Application = require('spectron').Application
var assert = require('assert')
var exepath = 'C:/Program Files (x86)/yourproject/yourapp.exe'

var homePage = {
    /**
     * define elements
     */
	globaltrade: 'li.AppBar-GlobalTrade',
    username: '[name=user_id]',
    password: '[name=password]',
    submitButton: 'button.submit',
 

    /**
     * define or overwrite page methods
     */
	
	login: function(username,password) {
		return this.app.client.waitUntilWindowLoaded()
            .click(homePage.globaltrade).waitForVisible(homePage.username)
			.setValue(homePage.username,username)
			.setValue(homePage.password,password)
			.click(homePage.submitButton)
    },
	
    quit: function() { if (this.app && this.app.isRunning()) {
      return this.app.stop()
    }},
	
	run: function() {
		this.app = new Application({
		    path:exepath
		})
		return this.app.start()
	}
};
module.exports = homePage;
